package com.cy.pj.notice.dao.Impl;

import com.cy.pj.notice.dao.SysNoticeDao;
import com.cy.pj.notice.pojo.SysNotice;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository //默认bean的名字为类名，然后首字母小写
public class SysNoticeDaoImpl implements SysNoticeDao {
    @Autowired

    private SqlSession sqlSession;
    @Override
    public List<SysNotice> selectNotices(SysNotice notice) {
        String namespace = this.getClass().getInterfaces()[0].getName();
        System.out.println("namespace"+namespace);
//        方法需要在栈中的线程查找
        String namemethod = Thread.currentThread().getStackTrace()[1].getMethodName();
        System.out.println(namemethod);
//        String statement = "com.cy.pj.notice.dao.SysNoticeDao";
        String statement = namespace+"."+namemethod;
        List<SysNotice> list = sqlSession.selectList(statement, notice);

        return list;
    }

    @Override
    public int deleteById(Long... id) {
        return 0;
    }

    @Override
    public int insertNotice(SysNotice notice) {
        return 0;
    }

    @Override
    public SysNotice findById(Long id) {
        return null;
    }

    @Override
    public int updateNotice(SysNotice notice) {
        return 0;
    }
}
